home *** CD-ROM | disk | FTP | other *** search
/ Enigma Amiga Life 109 / EnigmaAmiga109CD.iso / dalla rivista / amiga.free / sorgenti vari / wolfedit2 2.0.4 source.sit / WolfEdit2 2.0.4 Source / UMapDoc.p < prev    next >
Text File  |  1994-11-11  |  1KB  |  62 lines

  1. unit UMapDoc;
  2.  
  3. interface
  4.     uses
  5.         UGoof;
  6.  
  7.     type
  8.  
  9.         IndexEntry = record
  10.                 resource: LevelHandle;
  11.                 map: TMap;
  12.             end;
  13.  
  14.         IndexHandle = ^IndexPtr;
  15.         IndexPtr = ^IndexEntries;
  16.         IndexEntries = array[1..9999] of IndexEntry;
  17.  
  18.         TMapListDoc = object(TDocument)
  19.                 fNumLevels: integer;
  20.                 fIndex: IndexHandle;
  21.                 procedure IMapListDoc;
  22.                 procedure Free;
  23.                 override;
  24.             end;
  25.  
  26.         TMap = object(TObject)
  27.                 fMapList: TMapListDoc;
  28.                 fLevelNumber: integer;
  29.                 fChanged: boolean;
  30.                 fCells: packed array[0..63, 0..63] of 0..255;
  31.                 procedure IMap (itsMapList: TMapListDoc; itsLevelNumber: integer);
  32.                 procedure Free;
  33.                 override;
  34.                 procedure LoadFromResource (h: LevelHandle);
  35.                 function CreateResource: LevelHandle;
  36.                 function MakeOwnView: TView;
  37.             end;
  38.  
  39. implementation
  40.  
  41.     procedure TMapListDoc.IMapListDoc;
  42.     begin
  43.         IDocument;
  44.         fNumLevels := 0;
  45.         fIndex := IndexHandle(NewHandle(0));
  46.     end;
  47.  
  48.     procedure TMapListDoc.Free;
  49.         var
  50.             i: integer;
  51.             h: Handle;
  52.     begin
  53.         for i := 1 to fNumLevels do begin
  54.                 FreeObject(fIndex^^[i].map);
  55.                 h := fIndex^^[i].resource;
  56.                 if h <> nil then
  57.                     DisposHandle(h);
  58.             end;
  59.         DisposHandle(Handle(fIndex));
  60.     end;
  61.  
  62. end.